<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>重置一个 libcurl 会话句柄的所有的选项</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.curl-reset" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_reset</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7)</p><p class="refpurpose"><span class="refname">curl_reset</span> &mdash; <span class="dc-title">重置一个 libcurl 会话句柄的所有的选项</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.curl-reset-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>curl_reset</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$ch</code></span>
   ) : <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   该函数将给定的 cURL 句柄所有选项重新设置为默认值。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.curl-reset-parameters">
  <h3 class="title">参数</h3>
  <dl>

   <dt>
<code class="parameter">ch</code>
</dt>
<dd>
<p class="para">由 <span class="function"><a href="curl_init.html" class="function">curl_init()</a></span> 返回的 cURL 句柄。</p></dd>

  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.curl-reset-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-reset-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5249">
    <p><strong>Example #1 <span class="function"><strong>curl_reset()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;创建一个url&nbsp;句柄<br /></span><span style="color: #0000BB">$ch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_init</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;设置&nbsp;CURLOPT_USERAGENT&nbsp;选项<br /></span><span style="color: #0000BB">curl_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CURLOPT_USERAGENT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"My&nbsp;test&nbsp;user-agent"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;重置所有的预先设置的选项<br /></span><span style="color: #0000BB">curl_reset</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;发送&nbsp;HTTP&nbsp;请求<br /></span><span style="color: #0000BB">curl_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CURLOPT_URL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'http://example.com/'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">curl_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;预先设置的&nbsp;user-agent&nbsp;不会被发送，它已经被&nbsp;curl_reset&nbsp;重置掉了<br /><br />//&nbsp;关闭句柄<br /></span><span style="color: #0000BB">curl_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.curl-reset-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="function"><strong>curl_reset()</strong></span> also resets the URL given as the <span class="function"><a href="curl_init.html" class="function">curl_init()</a></span> parameter.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.curl-reset-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="curl_setopt.html" class="function" rel="rdfs-seeAlso">curl_setopt()</a> - 设置 cURL 传输选项</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>